package com.yi.mall.search.controller;

import com.yi.mall.common.model.search.SkuEs;
import com.yi.mall.common.utils.ResponseEnum;
import com.yi.mall.common.utils.Result;
import com.yi.mall.search.service.ISkuEsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/search/skuEs")
public class SkuEsController {
    @Autowired
    private ISkuEsService skuEsService;
    @GetMapping("/importAll")
    public Result importAll() {
        skuEsService.saveAll();
        return Result.success(ResponseEnum.SUCCESS);
    }
    @PostMapping("/save")
    public Result save(@RequestBody SkuEs skuEs) {
        skuEsService.save(skuEs);
        return Result.success(ResponseEnum.SUCCESS);
    }
    @DeleteMapping("/delete/{id}")
    public Result delete(@PathVariable Long id) {
        skuEsService.deleteById(id);
        return Result.success(ResponseEnum.SUCCESS);
    }
}